package com.cloudbroker.openapi.manage.controller;

import com.cloudbroker.bcs.common.entity.HSBCPSBackVO;
import com.cloudbroker.bcs.common.util.VOUtil;
import com.cloudbroker.bcs.platform.dav.bizapi.service.base.vo.HSBCPSVO;
import com.cloudbroker.bcs.platform.dav.bizapi.service.chat.result.SchemeColorListResult;
import com.cloudbroker.bcs.platform.dav.bizapi.service.chat.vo.SchemeColorForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.chat.vo.SchemeColorIdForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.chat.vo.SchemeColorUpdateForm;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.chat.SchemeColorT2BizService;
import com.cloudbroker.bcs.platform.dav.common.ext.annotation.SaveLog;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import static com.cloudbroker.bcs.platform.dav.common.util.RequestUtil.getSingleParameterMapForBody;

/**
 * Created by zhaojp18008 on 2016/5/19.
 */
@Controller
public class SchemeController {
    @Resource
    private SchemeColorT2BizService schemeColorT2;

    /**
     * 获取颜色主题列表
     * @param request
     * @param jsonpcallback
     * @return
     */
    @ResponseBody
    @RequestMapping("/func_scheme_color_list_get")
    @SaveLog(remark = "获取颜色主题列表")
    public SchemeColorListResult funcSchemeColorListGet(HttpServletRequest request, String jsonpcallback){
        HSBCPSVO form = getSingleParameterMapForBody(request , HSBCPSVO.class);
        return VOUtil.setJsonpResult(schemeColorT2.funcSchemeColorListGet(form), jsonpcallback);
    }
    /**
     * 颜色主题添加
     * @param request
     * @param jsonpcallback
     * @return
     */
    @ResponseBody
    @RequestMapping("/func_scheme_color_add")
    @SaveLog(remark = "颜色主题添加")
    public HSBCPSBackVO funcSchemeColorAdd(HttpServletRequest request, String jsonpcallback){
        SchemeColorForm form = getSingleParameterMapForBody(request , SchemeColorForm.class);
        return VOUtil.setJsonpResult(schemeColorT2.funcSchemeColorAdd(form), jsonpcallback);
    }
    /**
     * 颜色主题更新
     * @param request
     * @param jsonpcallback
     * @return
     */
    @ResponseBody
    @RequestMapping("/func_scheme_color_update")
    @SaveLog(remark = "颜色主题更新")
    public HSBCPSBackVO funcSchemeColorUpdate(HttpServletRequest request, String jsonpcallback){
        SchemeColorUpdateForm form = getSingleParameterMapForBody(request , SchemeColorUpdateForm.class);
        return VOUtil.setJsonpResult(schemeColorT2.funcSchemeColorUpdate(form), jsonpcallback);
    }
    /**
     * 颜色主题删除
     * @param request
     * @param jsonpcallback
     * @return
     */
    @ResponseBody
    @RequestMapping("/func_scheme_color_del")
    @SaveLog(remark = "颜色主题删除")
    public HSBCPSBackVO funcSchemeColorDel(HttpServletRequest request, String jsonpcallback){
        SchemeColorIdForm form = getSingleParameterMapForBody(request , SchemeColorIdForm.class);
        return VOUtil.setJsonpResult(schemeColorT2.funcSchemeColorDel(form), jsonpcallback);
    }
    
}
